First draft of validation binding for chip #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Example usage:
Method 1
Define your validation options in your controller:
And in your HTML:
Method 2
You can define some validations right in your HTML like so:
In this example, validation options are added as
key:value
and separated with|
. To add an error message to a validation option use the-e
flag in the value portion of the option like so:key:value -e 'Your error message'
Validation Types
Validation types can be created and defined using
validate-VALIDATION_TYPE="VALIDATION_OPTIONS"
If a validation type is used but doesn't have any rules defined for it, it will pass validation but will throw a warning in the console.
Moving Forward
Would like to be able to define validation rules on the application level instead of within the validation script - some basic validation options could remain baked in, but for the most part I think it would be nice if you had to explicitly define your validation rules to suit your app.